/*
 * Created by JFormDesigner on Wed Jun 26 14:48:06 CST 2024
 */

package scct.yangxianpeng.ui;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

/**
 * @author 35403
 */
public class FormMain extends JFrame {
    public FormMain() {
        initComponents();
    }

    //    用户管理面板
    private void btnUser(ActionEvent e) {
//        创建用户管理面板
        PanelUserManager panelUserManager = new PanelUserManager(this);
//        先把已经加载的其他管理面板移除
        panelMain.removeAll();
//        将用户面板对象加入panelMain的center区域
        panelMain.add(panelUserManager, BorderLayout.CENTER);
//        刷新页面
        validate();
    }

    //    商品类别管理面板
    private void btnType(ActionEvent e) {
        PanelType panelType = new PanelType(this);
        panelMain.removeAll();
        panelMain.add(panelType, BorderLayout.CENTER);
        validate();
    }

    //    商品品牌管理面板
    private void btnBrand(ActionEvent e) {
        PanelBrand panelBrand = new PanelBrand(this);
        panelMain.removeAll();
        panelMain.add(panelBrand, BorderLayout.CENTER);
        validate();
    }

    private void initComponents() {
        // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents  @formatter:off
        // Generated using JFormDesigner Evaluation license - yang
        menuBar1 = new JMenuBar();
        menu1 = new JMenu();
        mnuUser = new JMenuItem();
        mnuExit = new JMenuItem();
        menu2 = new JMenu();
        mnuType = new JMenuItem();
        mnuBrand = new JMenuItem();
        mnuGoods = new JMenuItem();
        mnuSell = new JMenuItem();
        mnuAbout = new JMenu();
        mnuMy = new JMenuItem();
        panelMain = new JPanel();
        toolBar1 = new JToolBar();
        btnUser = new JButton();
        btnType = new JButton();
        btnBrand = new JButton();
        btnGoods = new JButton();

        //======== this ========
        setTitle("\u5546\u5e97\u7ba1\u7406\u7cfb\u7edf");
        var contentPane = getContentPane();
        contentPane.setLayout(new BorderLayout());

        //======== menuBar1 ========
        {

            //======== menu1 ========
            {
                menu1.setText("\u7cfb\u7edf");

                //---- mnuUser ----
                mnuUser.setText("\u7528\u6237\u7ba1\u7406");
                menu1.add(mnuUser);

                //---- mnuExit ----
                mnuExit.setText("\u9000\u51fa");
                menu1.add(mnuExit);
            }
            menuBar1.add(menu1);

            //======== menu2 ========
            {
                menu2.setText("\u7ba1\u7406");

                //---- mnuType ----
                mnuType.setText("\u7c7b\u522b\u7ba1\u7406");
                menu2.add(mnuType);

                //---- mnuBrand ----
                mnuBrand.setText("\u54c1\u724c\u7ba1\u7406");
                menu2.add(mnuBrand);

                //---- mnuGoods ----
                mnuGoods.setText("\u5546\u54c1\u7ba1\u7406");
                menu2.add(mnuGoods);

                //---- mnuSell ----
                mnuSell.setText("\u9500\u552e\u7ba1\u7406");
                menu2.add(mnuSell);
            }
            menuBar1.add(menu2);

            //======== mnuAbout ========
            {
                mnuAbout.setText("\u5173\u4e8e");

                //---- mnuMy ----
                mnuMy.setText("\u6211\u7684\u9879\u76ee");
                mnuAbout.add(mnuMy);
            }
            menuBar1.add(mnuAbout);
        }
        setJMenuBar(menuBar1);

        //======== panelMain ========
        {
            panelMain.setBorder (new javax. swing. border. CompoundBorder( new javax .swing .border .TitledBorder (new javax. swing
            . border. EmptyBorder( 0, 0, 0, 0) , "JF\u006frmD\u0065sig\u006eer \u0045val\u0075ati\u006fn", javax. swing. border. TitledBorder
            . CENTER, javax. swing. border. TitledBorder. BOTTOM, new java .awt .Font ("Dia\u006cog" ,java .
            awt .Font .BOLD ,12 ), java. awt. Color. red) ,panelMain. getBorder( )) )
            ; panelMain. addPropertyChangeListener (new java. beans. PropertyChangeListener( ){ @Override public void propertyChange (java .beans .PropertyChangeEvent e
            ) {if ("\u0062ord\u0065r" .equals (e .getPropertyName () )) throw new RuntimeException( ); }} )
            ;
            panelMain.setLayout(new BorderLayout());

            //======== toolBar1 ========
            {

                //---- btnUser ----
                btnUser.setIcon(new ImageIcon(getClass().getResource("/icon/user.png")));
                btnUser.setToolTipText("\u7528\u6237\u7ba1\u7406");
                btnUser.addActionListener(e -> btnUser(e));
                toolBar1.add(btnUser);

                //---- btnType ----
                btnType.setToolTipText("\u7c7b\u522b\u7ba1\u7406");
                btnType.setIcon(new ImageIcon(getClass().getResource("/icon/leibie.png")));
                btnType.addActionListener(e -> btnType(e));
                toolBar1.add(btnType);

                //---- btnBrand ----
                btnBrand.setToolTipText("\u54c1\u724c\u7ba1\u7406");
                btnBrand.setIcon(new ImageIcon(getClass().getResource("/icon/pinpai.png")));
                btnBrand.addActionListener(e -> btnBrand(e));
                toolBar1.add(btnBrand);

                //---- btnGoods ----
                btnGoods.setToolTipText("\u5546\u54c1\u7ba1\u7406");
                btnGoods.setIcon(new ImageIcon(getClass().getResource("/icon/shangpin.png")));
                toolBar1.add(btnGoods);
            }
            panelMain.add(toolBar1, BorderLayout.NORTH);
        }
        contentPane.add(panelMain, BorderLayout.CENTER);
        setSize(494, 375);
        setLocationRelativeTo(getOwner());
        // JFormDesigner - End of component initialization  //GEN-END:initComponents  @formatter:on
    }

    // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables  @formatter:off
    // Generated using JFormDesigner Evaluation license - yang
    private JMenuBar menuBar1;
    private JMenu menu1;
    private JMenuItem mnuUser;
    private JMenuItem mnuExit;
    private JMenu menu2;
    private JMenuItem mnuType;
    private JMenuItem mnuBrand;
    private JMenuItem mnuGoods;
    private JMenuItem mnuSell;
    private JMenu mnuAbout;
    private JMenuItem mnuMy;
    private JPanel panelMain;
    private JToolBar toolBar1;
    private JButton btnUser;
    private JButton btnType;
    private JButton btnBrand;
    private JButton btnGoods;
    // JFormDesigner - End of variables declaration  //GEN-END:variables  @formatter:on
}
